<!doctype html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="description" content="【免费】为中小微企业提供融资信息服务">
    <title>【免费】为中小微企业提供融资信息服务</title>
    <link rel="stylesheet" href="./views/loan/css/idangerous.swiper.css">
    <link rel="stylesheet" type="text/css" href="./views/loan/css/common.css">
    <style>
        /* Demo Syles */
        body {
            margin: 0;
            font-family: Arial, Helvetica, sans-serif;
            line-height: 1.5;
        }

        .device {
            width: 640px;
            height: 300px;
            padding: 30px 40px;
            border-radius: 20px;
            background: #111;
            border: 3px solid white;
            margin: 5px auto;
            position: relative;
            box-shadow: 0px 0px 5px #000;
        }

/*        .device .arrow-left {
            background: url(img/arrows.png) no-repeat left top;
            position: absolute;
            left: 10px;
            top: 50%;
            margin-top: -15px;
            width: 17px;
            height: 30px;
        }

        .device .arrow-right {
            background: url(img/arrows.png) no-repeat left bottom;
            position: absolute;
            right: 10px;
            top: 50%;
            margin-top: -15px;
            width: 17px;
            height: 30px;
        }*/

        .swiper-container {
            width: 100%;
        }

        .content-slide {
            padding: 20px;
            color: #fff;
        }

        .title {
            font-size: 25px;
            margin-bottom: 10px;
        }

        .pagination {
            position: absolute;
            left: 0;
            text-align: center;
            bottom: 5px;
            width: 100%;
            z-index: 9999;
        }

        .swiper-pagination-switch {
            display: inline-block;
            width: 10px;
            height: 10px;
            border-radius: 10px;
            background: #999;
            box-shadow: 0px 1px 2px #555 inset;
            margin: 0 3px;
            cursor: pointer;
        }

        .swiper-active-switch {
            background: #fff;
        }

        .swiperBox {
            width: 100%;
            position: relative;
        }

        img {
            width: 100%;
        }

        .centerGray {
            height: 5px;
            border-top: #eeeeee;
            border-bottom: #eeeeee;
            background: #f3f5f7;
            width: 100%;
            box-shadow: inset 0px 0px 4px 1px #e2e2e2;
        }

        .type {
            overflow: hidden;
            padding: 10px 0px;
        }

        .type div {
            float: left;
            width: 33.3%;
            text-align: center;
        }

        .type img {
            width: 50px;
        }

        .type p {
            margin: 0px;
            padding: 0px;
        }

        .bank {
            overflow: hidden;
            padding: 10px 0px;
            background: white;
            padding-bottom: 42px;
        }

        .bank img {
            float: left;
            width: 75px;
            margin-top: 12px;
            margin-left: 5px;
        }

        .bank div {
            float: left;
            width: 45%;
            margin-top: 12px;
            margin-left: 3%;
        }

        .bank p {
            line-height: 20px;
            margin: 0px;
            padding: 0px;
            font-size: 12px;
        }

        .bank .detail {
            width: 70px;
            float: right;
            margin-left: 0px;
            margin-right: 15px;
            margin-top: 27px;
            border: 1px solid #dcdcdc;
            text-align: center;
            box-sizing: border-box;
            line-height: 30px;
            border-radius: 5px;
            color: red;
            font-size: 12px;
        }

        .say {
            position: fixed;
            left: 0px;
            top: 0px;
            width: 100%;
            z-index: 999;
        }

        .say img {
            width: 18px;
            float: left;
            margin-right: 12px;
        }

        .say p {
            float: left;
            margin: 0px;
            padding: 0px;
        }
    </style>
</head>

<body>
<img alt="xsl" src="./views/xsl.jpg" border="0" style="display:none;"/>
    <div class="say">
        <marquee>
            <p style="font-size: 12px;color: red;">
                <img src="./views/loan/images/la.gif">
                特别声明：星丝路从未授权委托任何机构或个人开展任何有关星丝路的有偿信息服务。
                星丝路在提供信息服务过程中，不会向用户收取任何名义的费用。
            </p>
        </marquee>
    </div>
    <div class="swiperBox" style="opacity: 0;">
        <!--<a class="arrow-left" href="#"></a>
        <a class="arrow-right" href="#"></a>-->
        <div class="swiper-container">
            <div class="swiper-wrapper">
                <div class="swiper-slide">
                    <img src="./views/loan/images/bg1.jpg" alt="">
                </div>
                <div class="swiper-slide">
                    <img src="./views/loan/images/bg4.jpg" alt="">
                </div>
                <div class="swiper-slide">
                    <img src="./views/loan/images/bg3.jpg" alt="">
                </div>
            </div>
        </div>
        <div class="pagination"></div>
    </div>
    <a style="color: black;display: block;line-height: 30px;padding: 10px 0px;display: block;text-align: center;" href="tel:0576-89000991">拨打电话0576-89000991联系我们</a>
    <div class="centerGray"></div>
    <div class="type">
    </div>
    <div class="centerGray"></div>
    <div class="bank">
    </div>
    <footer class="footer" style="height: 40px!important;">
        <a href="login.html" class="ripple active"  style="font-size: 14px;"><span class="icon f1"  style="width: 17px;height: 17px;"></span>个人贷款</a>
        <!--<a href="enterpriseLoan.html" class="ripple"><span class="icon f2"></span>企业贷款</a>
        <a href="transferLoan.html" class="ripple"><span class="icon f3"></span>转贷基金</a>-->
        <a href="./views/loan/my.html" class="ripple"  style="font-size: 14px;"><span class="icon f4"  style="width: 17px;height: 17px;"></span>我的</a>
    </footer>
    <script src="./views/loan/scripts/jquery-1.10.1.min.js"></script>
    <script src="./views/loan/scripts/idangerous.swiper.min.js"></script>
    <!--<script src="http://wechatfe.github.io/vconsole/lib/vconsole.min.js?v=3.2.0"></script>-->
    <!--<script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>-->
    <script>
        // window.vConsole = new window.VConsole();
        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
            // 发送给好友
            WeixinJSBridge.on('menu:share:appmessage', function(argv){
                alert("发送给好友")
            });
            // 分享到朋友圈
            WeixinJSBridge.on('menu:share:timeline', function(argv){
                alert("分享到朋友圈")
            });
        }, false);
        function inits(){
            var mySwiper = new Swiper('.swiper-container', {
                pagination: '.pagination',
                loop: true,
                grabCursor: true,
                paginationClickable: true,
                calculateHeight: true,
                autoplay : 3000,
            })
            $('.arrow-left').on('click', function (e) {
                e.preventDefault()
                mySwiper.swipePrev()
            })
            $('.arrow-right').on('click', function (e) {
                e.preventDefault()
                mySwiper.swipeNext()
            })
            $(".swiperBox").css("opacity",1)
        }

        window.onload = function () {
            var Cookie = {
                set: function(key, val, expiresDays){
                    if (expiresDays){
                        var date = new Date();
                        date.setTime(date.getTime()+expiresDays*24*3600*1000);
                        var expiresStr = "expires=" + date.toGMTString() + ';' ;
                    } else {
                        var expiresStr = '';
                    }
                    document.cookie = key+'='+escape(val)+';' + expiresStr;
                },

                get: function(key){
                    var getCookie = document.cookie.replace(/[ ]/g,'');
                    var resArr = getCookie.split(';');
                    var res;
                    for (var i = 0; i < resArr.length; i++) {
                        var arr = resArr[i].split('=');
                        if (arr[0] == key){
                            res = arr[1];
                            break;
                        }
                    }
                    return unescape(res);
                }

            }

            function GetQueryString(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) return unescape(r[2]);
                return null;
            }
            if(Cookie.get("users") == "undefined"){
                if(GetQueryString("code")){
                    $.ajax({
                        url:"/loan/weichatAuth/getUserInfo",
                        type:"post",
                        data:{
                            code:GetQueryString("code")
                        },
                        success:function(s){
                            console.log(s)
                            Cookie.set("users",JSON.stringify(s))
                            $.ajax({
                                type:'post',
                                url:"/loan/loanUserInfo/queryUserForOpenId",
                                data:{
                                    openId:s.openid
                                },
                                success:function(ss){
                                    //console.log(ss.data.loanUserInfo,"asdasdasdasd")
                                    //console.log($.isEmptyObject(ss.data.loanUserInfo))
                                    if($.isEmptyObject(ss.data.loanUserInfo)){
                                        $.ajax({
                                            type:'post',
                                            url:"/loan/loanUserInfo/createLoanUserInfo",
                                            data:{
                                                openId:s.openid
                                            },
                                            success : function(data){
                                                //console.log(data)
                                                setCookie("user",JSON.stringify(data.data.userId))
                                                // $.ajax({
                                                //     type:'post',
                                                //     url:"/loan/loanVisitInfo/createLoanVisitInfo",
                                                //     data:{
                                                //         userId:data.data.userId,
                                                //         //visitCategoryId:categoryId,
                                                //         //visitProductId:productId
                                                //     }
                                                // })
                                            }
                                        })
                                    }else{
                                        setCookie("user",JSON.stringify(ss.data.loanUserInfo.id))
                                        // $.ajax({
                                        //     type:'post',
                                        //     url:"/loan/loanVisitInfo/createLoanVisitInfo",
                                        //     data:{
                                        //         userId:ss.data.loanUserInfo.id,
                                        //         //visitCategoryId:categoryId,
                                        //         //visitProductId:productId
                                        //     }
                                        // })
                                    }

                                }
                            })
                        }
                    })
                }else{
                    location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb23c2631ae4a16ed&redirect_uri=http%3a%2f%2ftzjiuyi.com%2flogin.html&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"
                }
            }

            var useragent = navigator.userAgent;
            // if (useragent.match(/MicroMessenger/i) != 'MicroMessenger') {
            //     // 这里警告框会阻塞当前页面继续加载
            //     alert('已禁止本次访问：您必须使用微信内置浏览器访问本页面！');
            //     // 以下代码是用javascript强行关闭当前页面
            //     var opened = window.open('about:blank', '_self');
            //     opened.opener = null;
            //     opened.close();
            // }



            function GetQueryString(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) return unescape(r[2]);

                return null;
            }

            console.log(GetQueryString("code"))
            //创建用户访问记录


            $.ajax({
                url:"/loan/loanCategory/loadLoanCategoryDataSet",
                type:"post",
                success:function(ss){
                    var a = ''
                    for (var i = 0;i<ss.data.dataSet.rows.length;i++){
                        a += "<div onclick='loadLoanProduct("+ss.data.dataSet.rows[i].id+")'>" +
                            "<img src='./views/loan/images/"+ss.data.dataSet.rows[i].logo_path+".png' alt='"+ ss.data.dataSet.rows[i].category_name +"'>" +
                            "<p>"+ ss.data.dataSet.rows[i].category_name +"</p><" +
                            "/div>"
                    }
                    $(".type").append(a)
                    inits()
                }
            })
            loadLoanProduct(null);
        }


        function loadLoanProduct(val){

            $(".bank").find("img").remove()
            $(".bank").find("div").remove()
            $.ajax({
                url:"/loan/loanBankProduct/loadLoanBankProductDataSet",
                type:"post",
                data:{category_id:val},
                success:function(ss){
                    var b = ''
                    for (var i = 0; i < ss.data.dataSet.rows.length; i++) {
                        b += "<img src='./views/loan/images/"+ss.data.dataSet.rows[i].logo_path+".jpg'><div><p>" + ss.data.dataSet.rows[i].loan_type_name + "</p><p>综合费用：" + ss.data.dataSet.rows[i].colligate_cost + "</p><p>贷款期限：" +
                            ss.data.dataSet.rows[i].loan_term +
                            "</p></div><div class='detail'><a href='./views/loan/apply.html?proid="+ss.data.dataSet.rows[i].id+"' style='color: red;text-decoration: none;'>贷款详情</a></div><div style='margin: 0px;margin-top: 10px;float: left;width: 100%;height: 1px;background: #dcdcdc;'></div>"
                    }
                    //setCookie("bank",JSON.stringify(ss.data.dataSet.rows))
                    $(".bank").append(b)
                    //console.log(ss.data.dataSet.rows)
                }
            })
        }

        function setCookie(name,value) {
            var Days = 30;
            var exp = new Date();
            exp.setTime(exp.getTime() + Days*24*60*60*1000);
            document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
        }

    </script>
</body>

</html>